
 
alter VIEW vwCustomerGoodsRefer
as
select  a.CCSID ,a.CorpCode,a.CopGNo as ECopGNo,
(select CopGName from EpGoods as b where b.CopGNo=a.CopGNo) as ECopGName,
(select CopGModel from EpGoods as b where b.CopGNo=a.CopGNo) as ECopGModel,
(select ErpUnit from EpGoods as b where b.CopGNo=a.CopGNo) as EErpUnit,
a.CorpCopGNo AS CCopGNo,
(select CopGName from CustomerGoods as b where b.CorpCopGNo=a.CorpCopGNo AND b.CorpCode=a.CorpCode) as CCopGName,
(select CopGModel from CustomerGoods as b where b.CorpCopGNo=a.CorpCopGNo AND b.CorpCode=a.CorpCode) as CCopGModel,
(select ErpUnit from CustomerGoods as b where b.CorpCopGNo=a.CorpCopGNo AND b.CorpCode=a.CorpCode) as CErpUnit,
a.TransRate,  CreateDate,Creator,LastModifyTime,Modifier
from  CustomerGoodsRefer as a

GO
 



alter VIEW vwVendorrGoodsRefer
as
select a.CCSID , a.CorpCode,a.CopGNo as ECopGNo,
(select CopGName from EpGoods as b where b.CopGNo=a.CopGNo) as ECopGName,
(select CopGModel from EpGoods as b where b.CopGNo=a.CopGNo) as ECopGModel,
(select ErpUnit from EpGoods as b where b.CopGNo=a.CopGNo) as EErpUnit,
a.CorpCopGNo AS CCopGNo,
(select CopGName from VendorGoods as b where b.CorpCopGNo=a.CorpCopGNo AND b.CorpCode=a.CorpCode) as CCopGName,
(select CopGModel from VendorGoods as b where b.CorpCopGNo=a.CorpCopGNo AND b.CorpCode=a.CorpCode) as CCopGModel,
(select ErpUnit from VendorGoods as b where b.CorpCopGNo=a.CorpCopGNo AND b.CorpCode=a.CorpCode) as CErpUnit,
a.TransRate,  CreateDate,Creator,LastModifyTime,Modifier
from  VendorrGoodsRefer as a



 